package com.mqz.seckill.controller;

import com.mqz.seckill.pojo.User;
import com.mqz.seckill.service.UserService;
import com.mqz.seckill.vo.RespBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;

    @RequestMapping("/info")
    @ResponseBody
    public RespBean info(User user) {

        return RespBean.success(user);
    }

    @RequestMapping("/updPwd")
    @ResponseBody
    public RespBean updatePassword(String userTicket, String password, HttpServletRequest request, HttpServletResponse response) {

        return userService.updatePassword(userTicket, password, request, response);
    }
}
